package bmptest.bmp.controller.logo;

import bmptest.bmp.entity.Logo;
import bmptest.bmp.service.logo.LogoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lyq
 * @date 2021/9/6 9:43
 * 增删改查测试类
 */

@RestController
public class LogoController {
    @Autowired
    private LogoService logoService;
    @CrossOrigin
    @GetMapping("/api/logo")
    public List<Logo> list() throws Exception {
        List l = logoService.list();
        return l;
    }


    @CrossOrigin
    @PostMapping("/api/add")
    public void add(@RequestBody Logo l) throws Exception{
        logoService.addAll(l);
    }

    @CrossOrigin
    @PostMapping("/api/delete")
    public void delete(@RequestBody Logo logo) throws Exception{
        logoService.delete(logo.getId());
    }

    @CrossOrigin
    @PostMapping("/api/update")
    public Logo update(@RequestBody Logo l) throws Exception {
        logoService.updateall(l);
        return l;
    }

}
